import 'bankcard_info.dart';

class ApBankListModel {
  List<AccountInfoModel>? list;

  static ApBankListModel fromJson(Map<String, dynamic>? map) {
    ApBankListModel apBankListModel = ApBankListModel();
    if (map == null) return apBankListModel;
    if (map['list'] is List) {
      apBankListModel.list = (map['list'] as List).map((o) => AccountInfoModel.fromMap(o)).toList();
    }
    return apBankListModel;
  }
}

class AccountInfoModel {
  String? id;
  String? actName;
  String? act;
  String? bankCode;
  String? cardType;

  static AccountInfoModel fromMap(Map<String, dynamic>? map) {
    AccountInfoModel listBean = AccountInfoModel();
    if (map == null) return AccountInfoModel();
    listBean.id = map['id'];
    listBean.actName = map['actName'];
    listBean.act = map['act'];
    listBean.bankCode = map['bankCode'];
    listBean.cardType = map['cardType'];
    return listBean;
  }

  ///获取银行名称
  String? getBankName() {
    if (bankCode?.isEmpty == true) {
      return "";
    }
    BankCardModel? model = BankcardInfo().getBankInfoMap(bankCode!);
    if (model == null) {
      return BankcardInfo().getBankName(bankCode!);
    }
    return model.bankName ?? "";
  }
}

class BankCardModel {
  String? bankLogoId;
  String? bankName;
  String? bankCardId;

  BankCardModel(this.bankLogoId, this.bankName, this.bankCardId);
}
